using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using FarPoint.Win.Spread;
using Spread.Common.DataStore;

namespace Spread.Filtering.Features
{
    public partial class FilterIntro : Spread.Common.Features.Sample.BaseSampleControl
    {
        #region Fields
        private AccessDataSource _dataSource;
        private int _prevComboColIndex = -1;
        #endregion

        #region ctor
        public FilterIntro()
        {
            InitializeComponent();
            Name = "Introduction";
            _dataSource = new DataService().AccessDataSource;

            InitSpreadSheet(fpSpread.ActiveSheet);
            InitControls();
            
            chkTextCondition.CheckedChanged += ChkTextCondition_CheckedChanged;
            chkNumberCondition.CheckedChanged += ChkNumberCondition_CheckedChanged;
            chkDateCondition.CheckedChanged += ChkDateCondition_CheckedChanged;
            chkStyleCondition.CheckedChanged += ChkStyleCondition_CheckedChanged;
            chkCustomCondition.CheckedChanged += ChkCustomCondition_CheckedChanged;
        }
        #endregion

        private void InitSpreadSheet(SheetView sheet)
        {
            sheet.DataSource = _dataSource.GetDataFrom("fpWine.mdb", "select OrderID, CustomerID," +
                "SalesPerson, OrderDate, ShippedDate, Freight from Orders");

            sheet.Columns[2].Width = 120;
            sheet.Columns[3, 4].Width = 80;
            sheet.Columns[5].Width = 70;

            sheet.SetMultipleRowHeights(0, sheet.RowCount, 20);

            Random random = new Random();
            var colors = Enum.GetValues(typeof(KnownColor));
            for (int row = random.Next(0, 4); row < sheet.RowCount; row += random.Next(1, 5))
            {
                sheet.Cells[row, 1].BackColor = Color.FromKnownColor((KnownColor)(colors.GetValue(
                    random.Next(27, colors.GetUpperBound(0) + 1))));
            }

            HideRowFilter hideRowFilter = new HideRowFilter(sheet);
            for (int col = 0; col < sheet.ColumnCount; ++col)
            {
                hideRowFilter.ColumnDefinitions.Add(new FilterColumnDefinition(col, FilterListBehavior.Custom));
                sheet.Columns[col].Tag = sheet.Columns[col].Label;
            }
            sheet.RowFilter = hideRowFilter;
            sheet.RowFilter.ShowFilterIndicator = false;

            sheet.AutoFilter = true;
        }

        private void InitControls()
        {
            string[] columns = new string[fpSpread.ActiveSheet.ColumnCount];
            for (int col = 0; col < fpSpread.ActiveSheet.ColumnCount; ++col)
                columns[col] = fpSpread.ActiveSheet.Columns[col].Label;

            comboTextCol.DataSource = columns;
            comboTextCol.SelectedItem = "SalesPerson";
            comboTextCol.Click += ComboColClicked;
            comboTextCol.SelectedIndexChanged += ComboTextCol_SelectedIndexChanged;

            comboNumberCol.DataSource = columns.ToList();
            comboNumberCol.SelectedItem = "Freight";
            comboNumberCol.SelectedIndexChanged += ComboNumberCol_SelectedIndexChanged;
            comboNumberCol.Click += ComboColClicked;

            comboDateCol.DataSource = new string[] { "OrderDate", "ShippedDate" };
            comboDateCol.SelectedItem = "OrderDate";
            comboDateCol.Click += ComboColClicked;
            comboDateCol.SelectedIndexChanged += ComboDateCol_SelectedIndexChanged;

            comboCustomCol.DataSource = columns.ToList();
            comboCustomCol.SelectedItem = "ShippedDate";
            comboCustomCol.Click += ComboColClicked;
            comboCustomCol.SelectedIndexChanged += ComboCustomCol_SelectedIndexChanged;

            txtTextCriteria.Text = "Steven Buchanan";
            txtTextCriteria.TextChanged += TxtTextCriteria_TextChanged;

            numericUpDown.Value = 50;
            numericUpDown.ValueChanged += NumericUpDown_ValueChanged;

            dateTimePicker.Value = new DateTime(1997, DateTime.Now.Month, DateTime.Now.Day);
            dateTimePicker.ValueChanged += DateTimePicker_ValueChanged;

            comboColor.DataSource = Enum.GetValues(typeof(KnownColor));
            comboColor.SelectedItem = KnownColor.Cyan;
            comboColor.SelectedIndexChanged += ComboColor_SelectedIndexChanged;

            comboCustom.Items.AddRange(new object[] { "Blank", "Non-Blank" });
            comboCustom.SelectedItem = "Blank";
            comboCustom.SelectedIndexChanged += ComboCustom_SelectedIndexChanged;  
        }

        #region Event handlers

        #region CheckBox Events
        private void ChkCustomCondition_CheckedChanged(object sender, EventArgs e)
        {
            comboCustom.Enabled = chkCustomCondition.Checked;
            comboCustomCol.Enabled = chkCustomCondition.Checked;

            FilterByBlankNonBlank(chkCustomCondition.Checked);
        }

        private void ChkStyleCondition_CheckedChanged(object sender, EventArgs e)
        {
            comboColor.Enabled = chkStyleCondition.Checked;

            if (chkStyleCondition.Checked)
                ResetPreviousFilter();

            FilterByColor(chkStyleCondition.Checked);
        }

        private void ChkDateCondition_CheckedChanged(object sender, EventArgs e)
        {
            dateTimePicker.Enabled = chkDateCondition.Checked;
            comboDateCol.Enabled = chkDateCondition.Checked;

            FilterByDate(chkDateCondition.Checked);
        }

        private void ChkNumberCondition_CheckedChanged(object sender, EventArgs e)
        {
            numericUpDown.Enabled = chkNumberCondition.Checked;
            comboNumberCol.Enabled = chkNumberCondition.Checked;

            FilterByNumber(chkNumberCondition.Checked);
        }

        private void ChkTextCondition_CheckedChanged(object sender, EventArgs e)
        {
            txtTextCriteria.Enabled = chkTextCondition.Checked;
            comboTextCol.Enabled = chkTextCondition.Checked;

            FilterByText(chkTextCondition.Checked);
        }
        #endregion

        #region Input controls Events
        private void ComboTextCol_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetPreviousFilter(sender as ComboBox);
            FilterByText(true);
        }

        private void TxtTextCriteria_TextChanged(object sender, EventArgs e)
        {
            FilterByText(true);
        }

        private void ComboDateCol_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetPreviousFilter(sender as ComboBox);
            FilterByDate(true);
        }

        private void DateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            FilterByDate(true);
        }

        private void ComboCustomCol_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetPreviousFilter(sender as ComboBox);
            FilterByBlankNonBlank(true);
        }

        private void ComboCustom_SelectedIndexChanged(object sender, EventArgs e)
        {
            FilterByBlankNonBlank(true);
        }

        private void ComboNumberCol_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetPreviousFilter(sender as ComboBox);
            FilterByNumber(true);
        }

        private void NumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            FilterByNumber(true);
        }

        private void ComboColor_SelectedIndexChanged(object sender, EventArgs e)
        {
            FilterByColor(true);
        }
        #endregion

        #endregion

        private void ComboColClicked(object sender, EventArgs e)
        {
            _prevComboColIndex = fpSpread.ActiveSheet.Columns[(sender as ComboBox).SelectedItem.ToString()].Index;
        }

        #region Filtering methods
        private void FilterByColor(bool enabled)
        {
            SheetView sheet = fpSpread.ActiveSheet;
            int colIndex = sheet.Columns["CustomerID"].Index;
            int defColIndex = sheet.RowFilter.ColumnDefinitions.GetColumnDefinitionIndexFromColumnIndex(colIndex);
            var fcd = sheet.RowFilter.ColumnDefinitions[defColIndex];

            sheet.AutoFilterReset(_prevComboColIndex);
            fcd.Filters.Clear();
            if (enabled)
            {
                ColorFilterItem filter = new ColorFilterItem(false, Color.FromKnownColor((KnownColor)comboColor.SelectedItem));
                fcd.Filters.Add(filter);

                sheet.AutoFilterColumn(colIndex, filter.DisplayName, 0);
            }
        }

        private void FilterByNumber(bool enabled)
        {
            SheetView sheet = fpSpread.ActiveSheet;
            int colIndex = sheet.Columns[comboNumberCol.SelectedItem.ToString()].Index;
            int defColIndex = sheet.RowFilter.ColumnDefinitions.GetColumnDefinitionIndexFromColumnIndex(colIndex);
            var fcd = sheet.RowFilter.ColumnDefinitions[defColIndex];

            sheet.AutoFilterReset(_prevComboColIndex);
            fcd.Filters.Clear();
            if (enabled)
            {
                CustomFilterItem filter = new CustomFilterItem(new FilterCondition(CustomFilterOperatorType.LessThan, numericUpDown.Value),
                    null, false);
                fcd.Filters.Add(filter);

                sheet.AutoFilterColumn(colIndex, filter.DisplayName, 0);
            }
        }

        private void FilterByBlankNonBlank(bool enabled)
        {
            SheetView sheet = fpSpread.ActiveSheet;
            int colIndex = sheet.Columns[comboCustomCol.SelectedItem.ToString()].Index;
            int defColIndex = sheet.RowFilter.ColumnDefinitions.GetColumnDefinitionIndexFromColumnIndex(colIndex);
            var fcd = sheet.RowFilter.ColumnDefinitions[defColIndex];

            sheet.AutoFilterReset(_prevComboColIndex);
            fcd.Filters.Clear();
            if (enabled)
            {
                CustomFilterItem filterBlank = new CustomFilterItem(new FilterCondition(CustomFilterOperatorType.Equal, string.Empty),
                    null, false);
                CustomFilterItem filterNonBlank = new CustomFilterItem(new FilterCondition(CustomFilterOperatorType.NotEqual, string.Empty),
                    null, false);
                fcd.Filters.Add(filterBlank);
                fcd.Filters.Add(filterNonBlank);
                
                sheet.AutoFilterColumn(colIndex, comboCustom.SelectedIndex == 0 ? filterBlank.DisplayName : 
                    filterNonBlank.DisplayName, comboCustom.SelectedIndex);
            }
        }

        private void FilterByDate(bool enabled)
        {
            SheetView sheet = fpSpread.ActiveSheet;
            int colIndex = sheet.Columns[comboCustomCol.SelectedItem.ToString()].Index;
            int defColIndex = sheet.RowFilter.ColumnDefinitions.GetColumnDefinitionIndexFromColumnIndex(colIndex);
            var fcd = sheet.RowFilter.ColumnDefinitions[defColIndex];

            sheet.AutoFilterReset(_prevComboColIndex);
            fcd.Filters.Clear();
            if (enabled)
            {
                CustomFilterItem filter = new CustomFilterItem(new FilterCondition(CustomFilterOperatorType.LessThan,
                    dateTimePicker.Value), null, false);
                fcd.Filters.Add(filter);
                
                sheet.AutoFilterColumn(colIndex, filter.DisplayName, 0);
            }
        }

        private void FilterByText(bool enabled)
        {
            SheetView sheet = fpSpread.ActiveSheet;
            int colIndex = sheet.Columns[comboTextCol.SelectedItem.ToString()].Index;
            int defColIndex = sheet.RowFilter.ColumnDefinitions.GetColumnDefinitionIndexFromColumnIndex(colIndex);
            var fcd = sheet.RowFilter.ColumnDefinitions[defColIndex];

            sheet.AutoFilterReset(_prevComboColIndex);
            fcd.Filters.Clear();
            if (enabled)
            {
                CustomFilterItem filter = new CustomFilterItem(new FilterCondition(CustomFilterOperatorType.Equal, txtTextCriteria.Text),
                    null, false);
                fcd.Filters.Add(filter);

                sheet.AutoFilterColumn(colIndex, filter.DisplayName, 0);
            }
        }
        #endregion

        private void ResetPreviousFilter(ComboBox currentColComboBox = null)
        {
            if (currentColComboBox == null)
            {
                if (comboTextCol.SelectedItem.ToString() == "CustomerID")
                    chkTextCondition.Checked = false;
                if (comboNumberCol.SelectedItem.ToString() == "CustomerID")
                    chkNumberCondition.Checked = false;
                if (comboCustomCol.SelectedItem.ToString() == "CustomerID")
                    chkCustomCondition.Checked = false;
                return;
            }

            if (comboTextCol != currentColComboBox && comboTextCol.SelectedItem == currentColComboBox.SelectedItem)
                chkTextCondition.Checked = false;
            if (comboNumberCol != currentColComboBox && comboNumberCol.SelectedItem == currentColComboBox.SelectedItem)
                chkNumberCondition.Checked = false;
            if (comboDateCol != currentColComboBox && comboDateCol.SelectedItem == currentColComboBox.SelectedItem)
                chkDateCondition.Checked = false;
            if (comboCustomCol != currentColComboBox && comboCustomCol.SelectedItem == currentColComboBox.SelectedItem)
                chkCustomCondition.Checked = false;

            if (currentColComboBox.SelectedItem.ToString() == "CustomerID")
                chkStyleCondition.Checked = false;
        }
    }
}

//
//FilterIntro.Designer.cs
//


namespace Spread.Filtering.Features
{
    partial class FilterIntro
    {
        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.fpSpread = new FarPoint.Win.Spread.FpSpread();
            this.fpSpread_Sheet1 = new FarPoint.Win.Spread.SheetView();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
            this.numericUpDown = new System.Windows.Forms.NumericUpDown();
            this.comboCustom = new System.Windows.Forms.ComboBox();
            this.comboCustomCol = new System.Windows.Forms.ComboBox();
            this.label9 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.chkCustomCondition = new System.Windows.Forms.CheckBox();
            this.label8 = new System.Windows.Forms.Label();
            this.chkStyleCondition = new System.Windows.Forms.CheckBox();
            this.comboDateCol = new System.Windows.Forms.ComboBox();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.chkDateCondition = new System.Windows.Forms.CheckBox();
            this.comboColor = new System.Windows.Forms.ComboBox();
            this.comboNumberCol = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.chkNumberCondition = new System.Windows.Forms.CheckBox();
            this.comboTextCol = new System.Windows.Forms.ComboBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txtTextCriteria = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.chkTextCondition = new System.Windows.Forms.CheckBox();
            this.pnlMain.SuspendLayout();
            this.pnlControls.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.fpSpread)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.fpSpread_Sheet1)).BeginInit();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown)).BeginInit();
            this.SuspendLayout();
            // 
            // pnlMain
            // 
            this.pnlMain.Controls.Add(this.fpSpread);
            // 
            // pnlControls
            // 
            this.pnlControls.Controls.Add(this.groupBox1);
            // 
            // fpSpread
            // 
            this.fpSpread.AccessibleDescription = "";
            this.fpSpread.Dock = System.Windows.Forms.DockStyle.Fill;
            this.fpSpread.Location = new System.Drawing.Point(0, 0);
            this.fpSpread.Name = "fpSpread";
            this.fpSpread.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] {
            this.fpSpread_Sheet1});
            this.fpSpread.Size = new System.Drawing.Size(477, 487);
            this.fpSpread.TabIndex = 0;
            // 
            // fpSpread_Sheet1
            // 
            this.fpSpread_Sheet1.Reset();
            this.fpSpread_Sheet1.SheetName = "Sheet1";
            // Formulas and custom names must be loaded with R1C1 reference style
            this.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
            this.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1;
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.dateTimePicker);
            this.groupBox1.Controls.Add(this.numericUpDown);
            this.groupBox1.Controls.Add(this.comboCustom);
            this.groupBox1.Controls.Add(this.comboCustomCol);
            this.groupBox1.Controls.Add(this.label9);
            this.groupBox1.Controls.Add(this.label10);
            this.groupBox1.Controls.Add(this.chkCustomCondition);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Controls.Add(this.chkStyleCondition);
            this.groupBox1.Controls.Add(this.comboDateCol);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.chkDateCondition);
            this.groupBox1.Controls.Add(this.comboColor);
            this.groupBox1.Controls.Add(this.comboNumberCol);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.chkNumberCondition);
            this.groupBox1.Controls.Add(this.comboTextCol);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.txtTextCriteria);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.chkTextCondition);
            this.groupBox1.Location = new System.Drawing.Point(5, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(149, 435);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Filter Criteria";
            // 
            // dateTimePicker
            // 
            this.dateTimePicker.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.dateTimePicker.Enabled = false;
            this.dateTimePicker.Location = new System.Drawing.Point(63, 217);
            this.dateTimePicker.Name = "dateTimePicker";
            this.dateTimePicker.Size = new System.Drawing.Size(81, 20);
            this.dateTimePicker.TabIndex = 27;
            // 
            // numericUpDown
            // 
            this.numericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.numericUpDown.Enabled = false;
            this.numericUpDown.Location = new System.Drawing.Point(63, 130);
            this.numericUpDown.Name = "numericUpDown";
            this.numericUpDown.Size = new System.Drawing.Size(79, 20);
            this.numericUpDown.TabIndex = 26;
            // 
            // comboCustom
            // 
            this.comboCustom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboCustom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboCustom.Enabled = false;
            this.comboCustom.FormattingEnabled = true;
            this.comboCustom.Location = new System.Drawing.Point(63, 366);
            this.comboCustom.Name = "comboCustom";
            this.comboCustom.Size = new System.Drawing.Size(79, 21);
            this.comboCustom.TabIndex = 25;
            // 
            // comboCustomCol
            // 
            this.comboCustomCol.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboCustomCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboCustomCol.Enabled = false;
            this.comboCustomCol.FormattingEnabled = true;
            this.comboCustomCol.Location = new System.Drawing.Point(64, 393);
            this.comboCustomCol.Name = "comboCustomCol";
            this.comboCustomCol.Size = new System.Drawing.Size(79, 21);
            this.comboCustomCol.TabIndex = 25;
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(7, 396);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(42, 13);
            this.label9.TabIndex = 24;
            this.label9.Text = "Column";
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(7, 369);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(56, 13);
            this.label10.TabIndex = 22;
            this.label10.Text = "Has Value";
            // 
            // chkCustomCondition
            // 
            this.chkCustomCondition.AutoSize = true;
            this.chkCustomCondition.Location = new System.Drawing.Point(7, 345);
            this.chkCustomCondition.Name = "chkCustomCondition";
            this.chkCustomCondition.Size = new System.Drawing.Size(111, 17);
            this.chkCustomCondition.TabIndex = 21;
            this.chkCustomCondition.Text = "Custom Condition:";
            this.chkCustomCondition.UseVisualStyleBackColor = true;
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(7, 306);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(41, 13);
            this.label8.TabIndex = 17;
            this.label8.Text = "Color is";
            // 
            // chkStyleCondition
            // 
            this.chkStyleCondition.AutoSize = true;
            this.chkStyleCondition.Location = new System.Drawing.Point(7, 282);
            this.chkStyleCondition.Name = "chkStyleCondition";
            this.chkStyleCondition.Size = new System.Drawing.Size(99, 17);
            this.chkStyleCondition.TabIndex = 16;
            this.chkStyleCondition.Text = "Style Condition:";
            this.chkStyleCondition.UseVisualStyleBackColor = true;
            // 
            // comboDateCol
            // 
            this.comboDateCol.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboDateCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboDateCol.Enabled = false;
            this.comboDateCol.FormattingEnabled = true;
            this.comboDateCol.Location = new System.Drawing.Point(63, 243);
            this.comboDateCol.Name = "comboDateCol";
            this.comboDateCol.Size = new System.Drawing.Size(81, 21);
            this.comboDateCol.TabIndex = 15;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(7, 246);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(42, 13);
            this.label5.TabIndex = 14;
            this.label5.Text = "Column";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(7, 219);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(38, 13);
            this.label6.TabIndex = 12;
            this.label6.Text = "Before";
            // 
            // chkDateCondition
            // 
            this.chkDateCondition.AutoSize = true;
            this.chkDateCondition.Location = new System.Drawing.Point(7, 195);
            this.chkDateCondition.Name = "chkDateCondition";
            this.chkDateCondition.Size = new System.Drawing.Size(99, 17);
            this.chkDateCondition.TabIndex = 11;
            this.chkDateCondition.Text = "Date Condition:";
            this.chkDateCondition.UseVisualStyleBackColor = true;
            // 
            // comboColor
            // 
            this.comboColor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboColor.Enabled = false;
            this.comboColor.FormattingEnabled = true;
            this.comboColor.Location = new System.Drawing.Point(64, 303);
            this.comboColor.Name = "comboColor";
            this.comboColor.Size = new System.Drawing.Size(79, 21);
            this.comboColor.TabIndex = 10;
            // 
            // comboNumberCol
            // 
            this.comboNumberCol.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboNumberCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboNumberCol.Enabled = false;
            this.comboNumberCol.FormattingEnabled = true;
            this.comboNumberCol.Location = new System.Drawing.Point(64, 156);
            this.comboNumberCol.Name = "comboNumberCol";
            this.comboNumberCol.Size = new System.Drawing.Size(79, 21);
            this.comboNumberCol.TabIndex = 10;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(7, 159);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(42, 13);
            this.label3.TabIndex = 9;
            this.label3.Text = "Column";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(7, 132);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(53, 13);
            this.label4.TabIndex = 7;
            this.label4.Text = "Less than";
            // 
            // chkNumberCondition
            // 
            this.chkNumberCondition.AutoSize = true;
            this.chkNumberCondition.Location = new System.Drawing.Point(7, 108);
            this.chkNumberCondition.Name = "chkNumberCondition";
            this.chkNumberCondition.Size = new System.Drawing.Size(113, 17);
            this.chkNumberCondition.TabIndex = 6;
            this.chkNumberCondition.Text = "Number Condition:";
            this.chkNumberCondition.UseVisualStyleBackColor = true;
            // 
            // comboTextCol
            // 
            this.comboTextCol.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.comboTextCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboTextCol.Enabled = false;
            this.comboTextCol.FormattingEnabled = true;
            this.comboTextCol.Location = new System.Drawing.Point(64, 67);
            this.comboTextCol.Name = "comboTextCol";
            this.comboTextCol.Size = new System.Drawing.Size(79, 21);
            this.comboTextCol.TabIndex = 5;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(6, 70);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(42, 13);
            this.label2.TabIndex = 4;
            this.label2.Text = "Column";
            // 
            // txtTextCriteria
            // 
            this.txtTextCriteria.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTextCriteria.Enabled = false;
            this.txtTextCriteria.Location = new System.Drawing.Point(64, 40);
            this.txtTextCriteria.Name = "txtTextCriteria";
            this.txtTextCriteria.Size = new System.Drawing.Size(79, 20);
            this.txtTextCriteria.TabIndex = 3;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 43);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(34, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Value";
            // 
            // chkTextCondition
            // 
            this.chkTextCondition.AutoSize = true;
            this.chkTextCondition.Location = new System.Drawing.Point(6, 19);
            this.chkTextCondition.Name = "chkTextCondition";
            this.chkTextCondition.Size = new System.Drawing.Size(97, 17);
            this.chkTextCondition.TabIndex = 1;
            this.chkTextCondition.Text = "Text Condition:";
            this.chkTextCondition.UseVisualStyleBackColor = true;
            // 
            // FilterIntro
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Name = "FilterIntro";
            this.pnlMain.ResumeLayout(false);
            this.pnlControls.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.fpSpread)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.fpSpread_Sheet1)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private FarPoint.Win.Spread.FpSpread fpSpread;
        private FarPoint.Win.Spread.SheetView fpSpread_Sheet1;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.NumericUpDown numericUpDown;
        private System.Windows.Forms.ComboBox comboCustom;
        private System.Windows.Forms.ComboBox comboCustomCol;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.CheckBox chkCustomCondition;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.CheckBox chkStyleCondition;
        private System.Windows.Forms.ComboBox comboDateCol;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.CheckBox chkDateCondition;
        private System.Windows.Forms.ComboBox comboColor;
        private System.Windows.Forms.ComboBox comboNumberCol;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.CheckBox chkNumberCondition;
        private System.Windows.Forms.ComboBox comboTextCol;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtTextCriteria;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.CheckBox chkTextCondition;
        private System.Windows.Forms.DateTimePicker dateTimePicker;
    }
}
